package com.boot.system.service.Impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.boot.framework.constants.PageConstants;
import com.boot.framework.utils.Condition;
import com.boot.system.dto.SysOperateLogDTO;
import com.boot.system.entity.SysOperateLogEntity;
import com.boot.system.mapper.SysOperateLogMapper;
import com.boot.system.wrapper.SysOperateLogWrapper;
import com.boot.system.service.ISysOperateLogService;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 操作日志记录
 *
 * @author pig
 * @date 2024-03-09 14:35:02
 */
@Service
public class SysOperateLogServiceImpl extends ServiceImpl<SysOperateLogMapper, SysOperateLogEntity> implements ISysOperateLogService {
    private LambdaQueryWrapper<SysOperateLogEntity> getQueryWrapper(Map<String, Object> params) {
        LambdaQueryWrapper<SysOperateLogEntity> wrapper = Wrappers.lambdaQuery(SysOperateLogEntity.class);
        wrapper.orderByDesc(SysOperateLogEntity::getOperTime);
        return wrapper;
    }

    @Override
    public IPage<SysOperateLogDTO> selectPage(Map<String, Object> params) {

        return SysOperateLogWrapper.build().pageDTO(baseMapper.selectPage(Condition.getPage(params), getQueryWrapper(params)));
    }
}